'''TxtDataloader.'''
import linecache
from core.utils import get_time

class TxtDataloader():
    '''It's a class which used to read dataset in txt data format.'''

    def __init__(self, path, batch_size):
        self.path = path
        self.batch_size = batch_size
        self.last_read_line = 2

    def next_batch_data(self):
        '''read next batch data.'''
        batch_data = []
        for i in range(self.last_read_line, self.last_read_line + self.batch_size):
            line = linecache.getline(self.path, i).strip()
            batch_data.append(line)
        self.last_read_line += self.batch_size
        return batch_data

if __name__ == '__main__':
    data_loader = TxtDataloader('../dataset/text_overall_emotion.txt', 10)
    print(data_loader.next_batch_data())
    print(data_loader.next_batch_data())